/**
 @Name：CPUIAdmin
 @Author：cplvfx(橙)
 @Site：http://www.gerenwaibao.com/
 **/

layui.define(['element'], function (exports) {

    var $ = layui.jquery
        , element = layui.element
        //对外接口
        , index = function () { }
        , $body = $('body'); 

    //页面跳转
    $body.on('click', '*[CP-href]', function () {
        var othis = $(this)
            , href = othis.attr('CP-href');
        $("#cp_app_body iframe").attr('src', href);
    });

    //头部导航，切换左侧菜单
    $body.on('click', '*[cp-top-nav-href]', function () {
        var othis = $(this)
            , name = othis.attr('cp-top-nav-href'); 
            //绑定数据
            document.getElementById('cp-left-nav').innerHTML = eval(name+"_html.innerHTML");
            //更新渲染element
            element.render('nav', name);
    });

    //加载初始化左侧导航
    $(document).ready(function(){  
        document.getElementById('cp-left-nav').innerHTML = content_html.innerHTML;
        element.render('nav', 'content');
    });
 

    //对外输出
    exports('index', index);
});
 
 